// 检查指定页面必须要登录才能访问
// export default (to, from) => {
//   if (!['/login', '/'].includes(to.path)) {
//     if (!window.sessionStorage.getItem('token')) {
//       return { path: '/login', replace: true }
//     }
//   }
// }

// export default function checkLogin(name) {
//   return function (to, from) {}
// }

export default name => (to, from) => {
  console.log(name)
  if (!['/login', '/'].includes(to.path)) {
    if (!window.sessionStorage.getItem('token')) {
      return { path: '/login', replace: true }
    }
  }
}
